﻿using System.ComponentModel;

namespace WpfApp1.Acme.ApplicationClass {

    /// <summary>
    /// 数据双向绑定类和ViewData、ViewPage
    /// 类实现前端视图的实时刷新
    /// </summary>
    internal class ViewTwoWayBinding : INotifyPropertyChanged {
        private static readonly ViewTwoWayBinding Instance = new ViewTwoWayBinding();
        public event PropertyChangedEventHandler PropertyChanged;

        public void onPropertyChanged(string propertyName) {
            
            if (PropertyChanged is not null) {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }

        }

        /// <summary>
        /// 获取数据双向绑定类
        /// </summary>
        /// <returns></returns>
        public static ViewTwoWayBinding get() { return Instance; }
    }
}
